<template>
  <el-dialog
    title="详情"
    :close-on-click-modal="false"
    append-to-body
    :visible.sync="visible"
    class="jsbos-dialog jsbos-dialog_center"
    lock-scroll
    width="600px"
  >
    <el-row :gutter="15" class="">
      <el-form
        v-loading="loading"
        ref="elForm"
        :model="dataForm"
        size="small"
        label-width="100px"
        label-position="right"
      >
        <template v-if="!loading">
          <el-col :span="24">
            <el-tabs
              v-model="activeuuggdb"
              type="card"
              tab-position="top"
              class="mb-20"
            >
              <el-tab-pane label="阶段 1">
                <el-col :span="24">
                  <el-collapse
                    :accordion="false"
                    v-model="activewqmslv"
                    class="mb-20"
                  >
                    <el-collapse-item title="阶段信息" name="1">
                      <el-col :span="24">
                        <el-form-item label="说明" prop="description">
                          <p>{{ dataForm.description }}</p>
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <el-form-item label="阶段内闯关" prop="challenge">
                          <p>{{ dataForm.challenge }}</p>
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <el-form-item label="排序" prop="sortCode">
                          <p>{{ dataForm.sortCode }}</p>
                        </el-form-item>
                      </el-col>
                    </el-collapse-item>
                  </el-collapse>
                </el-col>
                <el-col :span="24">
                  <el-form-item label-width="0">
                    <div class="jsbos-common-title">
                      <h2>学习内容</h2>
                    </div>
                    <el-table
                      :data="dataForm.temssubjectstagerelationList"
                      size="mini"
                    >
                      <el-table-column
                        type="index"
                        width="50"
                        label="序号"
                        align="center"
                      />
                      <el-table-column prop="subjectId" label="专题ID">
                        <template slot-scope="scope">
                          <p>{{ scope.row.subjectId }}</p>
                        </template>
                      </el-table-column>
                      <el-table-column prop="subjectStageId" label="阶段ID">
                        <template slot-scope="scope">
                          <p>{{ scope.row.subjectStageId }}</p>
                        </template>
                      </el-table-column>
                      <el-table-column prop="objectType" label="对象类型">
                        <template slot-scope="scope">
                          <p>
                            {{
                              scope.row.objectType
                                | dynamicText(objectTypeOptions)
                            }}
                          </p>
                        </template>
                      </el-table-column>
                      <el-table-column prop="objectId" label="对象主键">
                        <template slot-scope="scope">
                          <p>{{ scope.row.objectId }}</p>
                        </template>
                      </el-table-column>
                      <el-table-column prop="type" label="类型">
                        <template slot-scope="scope">
                          <p>{{ scope.row.type | dynamicText(typeOptions) }}</p>
                        </template>
                      </el-table-column>
                      <el-table-column prop="sortCode" label="排序">
                        <template slot-scope="scope">
                          <p>{{ scope.row.sortCode }}</p>
                        </template>
                      </el-table-column>
                    </el-table>
                  </el-form-item>
                </el-col>
              </el-tab-pane>
              <el-tab-pane label="阶段 2"> </el-tab-pane>
            </el-tabs>
          </el-col>
        </template>
      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false"> 取 消</el-button>
    </span>
  </el-dialog>
</template>
<script>
import request from "@/utils/request";
import PrintBrowse from "@/components/print-browse";
import jsbos from "@/utils/jsbos";

export default {
  components: { PrintBrowse },
  props: [],
  data() {
    return {
      visible: false,
      loading: false,
      printBrowseVisible: false,
      printId: "",
      dataForm: {
        id: "",
        subjectId: "",
        name: "学习内容",
        description: "",
        challenge: 0,
        sortCode: 1,
        temssubjectstagerelationList: [],
      },
      activeuuggdb: "0",
      activewqmslv: ["1"],

      objectTypeOptions: [
        { fullName: "选项一", id: "1" },
        { fullName: "选项二", id: "2" },
      ],
      typeOptions: [
        { fullName: "选修 ", id: "1" },
        { fullName: "必修", id: "2" },
      ],
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    dataInfo(dataAll) {
      let _dataAll = dataAll;
      for (let i = 0; i < _dataAll.temssubjectstagerelationList.length; i++) {
        var _list = _dataAll.temssubjectstagerelationList[i];
      }
      this.dataForm = _dataAll;
    },

    init(id) {
      this.dataForm.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.loading = true;
          request({
            url: "/api/course/TemsSubjectStage/detail/" + this.dataForm.id,
            method: "get",
          }).then((res) => {
            this.dataInfo(res.data);
            this.loading = false;
          });
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.jsbos-row-style {
  padding: 10px 10px 10px 0;

  > .el-row {
    margin: 0 !important;
    padding: 0 16px;
  }

  .el-row:nth-child(0) {
    padding: 0px !important;
  }

  > .el-col {
    padding: 0px !important;

    .el-form-item {
      margin-bottom: -1px !important;
      margin-right: -1px;
      border: 1px solid var(--border-4) !important;
      background-color: var(--light-blue) !important;
    }

    .el-form-item__label {
      line-height: 38px;
      height: 100%;
    }

    .el-form-item__content {
      line-height: 38px;
      padding-left: 20px;
      background-color: var(--white) !important;
      border-left: 1px solid var(--border-4) !important;
    }
  }
}
</style>
